<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    hostname: new URL('https://wzc570738205.github.io').hostname,
    root: '/',
    scheme: 'Gemini',
    version: '7.7.0',
    exturl: true,
    sidebar: {"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},
    copycode: {"enable":true,"show_result":true,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":true,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    comments: {"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: 'search.xml',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}
  };
</script>

  <meta name="description" content="vue引入swiper  vue使用swiper  vue脚手架使用swiper &#x2F;引入js文件&#x2F;引入css文件">
<meta property="og:type" content="article">
<meta property="og:title" content="vue引入swiper">
<meta property="og:url" content="https://wzc570738205.github.io/2017/04/09/vue%E5%BC%95%E5%85%A5swiper/index.html">
<meta property="og:site_name" content="王志超的博客">
<meta property="og:description" content="vue引入swiper  vue使用swiper  vue脚手架使用swiper &#x2F;引入js文件&#x2F;引入css文件">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://wzc570738205.github.io/2017/04/09/vue%E5%BC%95%E5%85%A5swiper/logo.png">
<meta property="og:image" content="https://user-gold-cdn.xitu.io/2020/1/4/16f6c6310e966f77?w=670&h=584&f=bmp&s=1175076">
<meta property="og:image" content="https://user-gold-cdn.xitu.io/2020/1/4/16f6c631106ff801?w=830&h=634&f=png&s=61090">
<meta property="article:published_time" content="2017-04-09T22:57:16.000Z">
<meta property="article:modified_time" content="2020-01-20T07:16:25.888Z">
<meta property="article:author" content="王志超">
<meta property="article:tag" content="javascript">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://wzc570738205.github.io/2017/04/09/vue%E5%BC%95%E5%85%A5swiper/logo.png">

<link rel="canonical" href="https://wzc570738205.github.io/2017/04/09/vue%E5%BC%95%E5%85%A5swiper/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true
  };
</script>

  <title>vue引入swiper | 王志超的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">王志超的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <h1 class="site-subtitle" itemprop="description">今天你更博学了吗</h1>
      
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-首页">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-关于">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-标签">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-分类">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-归档">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="none"
           placeholder="搜索..." spellcheck="false"
           type="text" id="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>
  <a role="button" class="book-mark-link book-mark-link-fixed"></a>

  <span class="exturl github-corner" data-url="aHR0cHM6Ly9naXRodWIuY29tL3d6YzU3MDczODIwNQ==" title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></span>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://wzc570738205.github.io/2017/04/09/vue%E5%BC%95%E5%85%A5swiper/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/logo.png">
      <meta itemprop="name" content="王志超">
      <meta itemprop="description" content="记录前端的点点滴滴">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="王志超的博客">
    </span>
      <header class="post-header">
        <h2 class="post-title" itemprop="name headline">
          vue引入swiper
        </h2>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2017-04-09 22:57:16" itemprop="dateCreated datePublished" datetime="2017-04-09T22:57:16+00:00">2017-04-09</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-01-20 07:16:25" itemprop="dateModified" datetime="2020-01-20T07:16:25+00:00">2020-01-20</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%89%8D%E7%AB%AF%E7%9F%A5%E8%AF%86/" itemprop="url" rel="index">
                    <span itemprop="name">前端知识</span>
                  </a>
                </span>
            </span>

          
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2017/04/09/vue%E5%BC%95%E5%85%A5swiper/#comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2017/04/09/vue%E5%BC%95%E5%85%A5swiper/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <img src="/2017/04/09/vue%E5%BC%95%E5%85%A5swiper/logo.png" class="" title="This is an example image">

<h3 id="vue引入swiper-vue使用swiper-vue脚手架使用swiper-引入js文件-引入css文件"><a href="#vue引入swiper-vue使用swiper-vue脚手架使用swiper-引入js文件-引入css文件" class="headerlink" title="vue引入swiper  vue使用swiper  vue脚手架使用swiper /引入js文件/引入css文件"></a>vue引入swiper  vue使用swiper  vue脚手架使用swiper /引入js文件/引入css文件</h3><a id="more"></a>

<div class="note success no-icon">
            <p>欢迎加入前端交流群：<a href="//shang.qq.com/wpa/qunwpa?idkey=f528775f242a7c39fe8512383febb8990e621bf97354c2fb82f6832097b7c501" target="_blank" rel="noopener">749539640</a> </p>
          </div>
<hr>
<pre><code>转载文章请注明出处！               </code></pre><hr>
<p> 如果只是要使用轮播效果的话可以参考下一些vue组件；比如这篇文章</p>
<p>——–2019.7.9——————</p>
<p>请参考swiper官方插件：<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL3N1cm1vbi1jaGluYS92dWUtYXdlc29tZS1zd2lwZXI=" title="https://github.com/surmon-china/vue-awesome-swiper">https://github.com/surmon-china/vue-awesome-swiper<i class="fa fa-external-link"></i></span></p>
<p>——–2019.7.9——————</p>
<h4 id="方法一：（-请先使用这种方法；更新于2018-05-14）"><a href="#方法一：（-请先使用这种方法；更新于2018-05-14）" class="headerlink" title="方法一：（ 请先使用这种方法；更新于2018-05-14）"></a>方法一：（ 请先使用这种方法；更新于2018-05-14）</h4><p>下载swiper：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install swiper --save-dev</span><br></pre></td></tr></table></figure>
<p>swiper4.0使用入口：<span class="exturl" data-url="aHR0cDovL3d3dy5zd2lwZXIuY29tLmNuL3VzYWdlL2luZGV4Lmh0bWw=" title="http://www.swiper.com.cn/usage/index.html">http://www.swiper.com.cn/usage/index.html<i class="fa fa-external-link"></i></span>；</p>
<h3 id="html："><a href="#html：" class="headerlink" title="html："></a>html：</h3> <figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-container"</span>&gt;</span><br><span class="line">    &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-wrapper"</span>&gt;</span><br><span class="line">        &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-slide"</span>&gt;Slide <span class="number">1</span>&lt;<span class="regexp">/div&gt;</span></span><br><span class="line"><span class="regexp">        &lt;div class="swiper-slide"&gt;Slide 2&lt;/</span>div&gt;</span><br><span class="line">        &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-slide"</span>&gt;Slide <span class="number">3</span>&lt;<span class="regexp">/div&gt;</span></span><br><span class="line"><span class="regexp">    &lt;/</span>div&gt;</span><br><span class="line">    &lt;!-- 如果需要分页器 --&gt;</span><br><span class="line">    &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-pagination"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line">    </span><br><span class="line">    &lt;!-- 如果需要导航按钮 --&gt;</span><br><span class="line">    &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-button-prev"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line">    &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-button-next"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line">    </span><br><span class="line">    &lt;!-- 如果需要滚动条 --&gt;</span><br><span class="line">    &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-scrollbar"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line">&lt;<span class="regexp">/div&gt;</span></span><br></pre></td></tr></table></figure>

<p>在需要使用swiper的组件里引入swiper，swiper的初始化放在mounted里（可以把官网例子的启动 var mySwiper =  删掉）；</p>
<h3 id="js："><a href="#js：" class="headerlink" title="js："></a>js：</h3> <figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">&lt;script&gt;</span><br><span class="line"><span class="keyword">import</span> Swiper <span class="keyword">from</span> <span class="string">'swiper'</span>;</span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">  name: <span class="string">'HelloWorld'</span>,</span><br><span class="line">  data () &#123;</span><br><span class="line">    <span class="keyword">return</span> &#123;</span><br><span class="line">      msg: <span class="string">'Welcome to Your Vue.js App'</span></span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line">  mounted()&#123;</span><br><span class="line">     <span class="keyword">new</span> Swiper (<span class="string">'.swiper-container'</span>, &#123;</span><br><span class="line">    loop: <span class="literal">true</span>,</span><br><span class="line">    <span class="comment">// 如果需要分页器</span></span><br><span class="line">    pagination: <span class="string">'.swiper-pagination'</span>,</span><br><span class="line">    <span class="comment">// 如果需要前进后退按钮</span></span><br><span class="line">    nextButton: <span class="string">'.swiper-button-next'</span>,</span><br><span class="line">    prevButton: <span class="string">'.swiper-button-prev'</span>,</span><br><span class="line">    <span class="comment">// 如果需要滚动条</span></span><br><span class="line">    scrollbar: <span class="string">'.swiper-scrollbar'</span>,</span><br><span class="line">  &#125;)        </span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line">&lt;<span class="regexp">/script&gt;</span></span><br></pre></td></tr></table></figure>
<h3 id="css："><a href="#css：" class="headerlink" title="css："></a>css：</h3><p>在main.js里引入css</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> Vue <span class="keyword">from</span> <span class="string">'vue'</span></span><br><span class="line"><span class="keyword">import</span> <span class="string">'swiper/dist/css/swiper.css'</span>;</span><br></pre></td></tr></table></figure>
<p>然后我们在用到swiper的组件里写点样式</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">style</span> <span class="attr">scoped</span>&gt;</span></span><br><span class="line"><span class="css"> <span class="selector-class">.swiper-container</span> &#123;</span></span><br><span class="line">        width: 500px;</span><br><span class="line">        height: 300px;</span><br><span class="line">        margin: 20px auto;</span><br><span class="line">    &#125;</span><br><span class="line"><span class="tag">&lt;/<span class="name">style</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>———————————–我是分割线———————————————————–</p>
<h3 id="方法二：（以下是2017年4月写的-废弃）"><a href="#方法二：（以下是2017年4月写的-废弃）" class="headerlink" title="方法二：（以下是2017年4月写的,废弃）"></a>方法二：（以下是2017年4月写的,废弃）</h3><p>1.安装vue-cli</p>
<p>参考地址：<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL3Z1ZWpzL3Z1ZS1jbGk=" title="https://github.com/vuejs/vue-cli">https://github.com/vuejs/vue-cli<i class="fa fa-external-link"></i></span></p>
<p>如果不使用严格语法需要在后三项打no；（加了挺头疼的，老是报错，但是对自己的代码规范性也是有很大的帮助的）</p>
<p>2.swiper下载示例代码</p>
<p>参考地址：<span class="exturl" data-url="aHR0cDovL3d3dy5zd2lwZXIuY29tLmNuL3VzYWdlL2luZGV4Lmh0bWw=" title="http://www.swiper.com.cn/usage/index.html">http://www.swiper.com.cn/usage/index.html<i class="fa fa-external-link"></i></span></p>
<p>一：单个组件使用：</p>
<p>3.在刚下载好的vue-cli里的helloworld.vue进行代码编写。</p>
<h5 id="3-1html部分："><a href="#3-1html部分：" class="headerlink" title="3.1html部分："></a>3.1html部分：</h5><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"> <span class="number">1</span> &lt;template&gt;</span><br><span class="line"> <span class="number">2</span>   &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"hello"</span>&gt;</span><br><span class="line"> <span class="number">3</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-container"</span>&gt;</span><br><span class="line"> <span class="number">4</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-wrapper"</span>&gt;</span><br><span class="line"> <span class="number">5</span>         &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-slide"</span>&gt;Slide <span class="number">1</span>&lt;<span class="regexp">/div&gt;</span></span><br><span class="line"><span class="regexp"> 6         &lt;div class="swiper-slide"&gt;Slide 2&lt;/</span>div&gt;</span><br><span class="line"> <span class="number">7</span>         &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-slide"</span>&gt;Slide <span class="number">3</span>&lt;<span class="regexp">/div&gt;</span></span><br><span class="line"><span class="regexp"> 8     &lt;/</span>div&gt;</span><br><span class="line"> <span class="number">9</span>     &lt;!-- 如果需要分页器 --&gt;</span><br><span class="line"><span class="number">10</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-pagination"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="number">11</span>     </span><br><span class="line"><span class="number">12</span>     &lt;!-- 如果需要导航按钮 --&gt;</span><br><span class="line"><span class="number">13</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-button-prev"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="number">14</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-button-next"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="number">15</span>     </span><br><span class="line"><span class="number">16</span>     &lt;!-- 如果需要滚动条 --&gt;</span><br><span class="line"><span class="number">17</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-scrollbar"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="number">18</span> &lt;<span class="regexp">/div&gt;</span></span><br><span class="line"><span class="regexp">19   &lt;/</span>div&gt;</span><br><span class="line"><span class="number">20</span> &lt;<span class="regexp">/template&gt;</span></span><br></pre></td></tr></table></figure>
<h4 id="3-2-js部分："><a href="#3-2-js部分：" class="headerlink" title="3.2 js部分："></a>3.2 js部分：</h4><p>这里使用import引入swiper.js文件；</p>
<p>swiper的启动放在mounted里执行；</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">&lt;script&gt;</span><br><span class="line"><span class="keyword">import</span><span class="string">'../assets/js/swiper.min.js'</span></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">  name: <span class="string">'HelloWorld'</span>,</span><br><span class="line">  data () &#123;</span><br><span class="line">    <span class="keyword">return</span> &#123;</span><br><span class="line">      msg: <span class="string">'Welcome to Your Vue.js App'</span></span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line">  mounted()&#123;</span><br><span class="line">     <span class="keyword">var</span> mySwiper = <span class="keyword">new</span> Swiper (<span class="string">'.swiper-container'</span>, &#123;</span><br><span class="line">    loop: <span class="literal">true</span>,</span><br><span class="line">    <span class="comment">// 如果需要分页器</span></span><br><span class="line">    pagination: <span class="string">'.swiper-pagination'</span>,</span><br><span class="line">    <span class="comment">// 如果需要前进后退按钮</span></span><br><span class="line">    nextButton: <span class="string">'.swiper-button-next'</span>,</span><br><span class="line">    prevButton: <span class="string">'.swiper-button-prev'</span>,</span><br><span class="line">    <span class="comment">// 如果需要滚动条</span></span><br><span class="line">    scrollbar: <span class="string">'.swiper-scrollbar'</span>,</span><br><span class="line">  &#125;)        </span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br><span class="line">&lt;<span class="regexp">/script&gt;</span></span><br></pre></td></tr></table></figure>
<h5 id="3-3css部分："><a href="#3-3css部分：" class="headerlink" title="3.3css部分："></a>3.3css部分：</h5><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"> 1 &lt;<span class="selector-tag">style</span> <span class="selector-tag">scoped</span>&gt;</span><br><span class="line"> 2 <span class="keyword">@import</span>'../assets/css/swiper.min.css';</span><br><span class="line"> 3     <span class="selector-tag">body</span> &#123;</span><br><span class="line"> 4         margin: 0;</span><br><span class="line"> 5         <span class="selector-tag">padding</span>: 0;</span><br><span class="line"> 6     &#125;</span><br><span class="line"> 7     <span class="selector-class">.swiper-container</span> &#123;</span><br><span class="line"> 8         width: 500px;</span><br><span class="line"> 9         <span class="selector-tag">height</span>: 300<span class="selector-tag">px</span>;</span><br><span class="line">10         <span class="selector-tag">margin</span>: 20<span class="selector-tag">px</span> <span class="selector-tag">auto</span>;</span><br><span class="line">11     &#125;</span><br><span class="line">12    </span><br><span class="line">13 </span><br><span class="line">14     &lt;/style&gt;</span><br></pre></td></tr></table></figure>

<p>4.看似大工告成，这时候会报错：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Uncaught TypeError: Cannot assign to read only property &#39;exports&#39; of object &#39;#&lt;Object&gt;&#39;</span><br></pre></td></tr></table></figure>
<p>这个错误查文档说是：</p>
<p>在webpack打包的时候，可以在js文件中混用require和export。但是不能混用import 以及module.exports。</p>
<p>因为webpack 2中不允许混用import和module.exports</p>
<p>我们只需要吧.babelrc文件里的第11行代码插件项”plugins”: [“transform-runtime”],中的transform-runtime删掉即可；</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"> <span class="number">1</span> &#123;</span><br><span class="line"> 2   "presets": [</span><br><span class="line"> <span class="number">3</span>     [<span class="string">"env"</span>, &#123;</span><br><span class="line"> 4       "modules": false,</span><br><span class="line"> 5       "targets": &#123;</span><br><span class="line"> 6         "browsers": ["&gt; 1%", "last 2 versions", "not ie &lt;= 8"]</span><br><span class="line"> 7       &#125;</span><br><span class="line"> 8     &#125;],</span><br><span class="line"> <span class="number">9</span>     <span class="string">"stage-2"</span></span><br><span class="line">10   ],</span><br><span class="line">11   "plugins": [],</span><br><span class="line">12   "env": &#123;</span><br><span class="line">13     "test": &#123;</span><br><span class="line">14       "presets": ["env", "stage-2"],</span><br><span class="line">15       "plugins": ["istanbul"]</span><br><span class="line">16     &#125;</span><br><span class="line">17   &#125;</span><br><span class="line">18 &#125;</span><br></pre></td></tr></table></figure>
<p>5.好了问题解决；</p>
<p><img src="https://user-gold-cdn.xitu.io/2020/1/4/16f6c6310e966f77?w=670&h=584&f=bmp&s=1175076" alt=""></p>
<p>二：全局使用：</p>
<p>6.当然也可以全局使用swiper；代码如下；</p>
<p>还是在刚才的helloworld.vue进行代码编写；只是去掉js和css文件的引入！</p>
<p>helloworld.vue代码：</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br></pre></td><td class="code"><pre><span class="line"> <span class="number">1</span> &lt;template&gt;</span><br><span class="line"> <span class="number">2</span>   &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"hello"</span>&gt;</span><br><span class="line"> <span class="number">3</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-container"</span>&gt;</span><br><span class="line"> <span class="number">4</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-wrapper"</span>&gt;</span><br><span class="line"> <span class="number">5</span>         &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-slide"</span>&gt;Slide <span class="number">1</span>&lt;<span class="regexp">/div&gt;</span></span><br><span class="line"><span class="regexp"> 6         &lt;div class="swiper-slide"&gt;Slide 2&lt;/</span>div&gt;</span><br><span class="line"> <span class="number">7</span>         &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-slide"</span>&gt;Slide <span class="number">3</span>&lt;<span class="regexp">/div&gt;</span></span><br><span class="line"><span class="regexp"> 8     &lt;/</span>div&gt;</span><br><span class="line"> <span class="number">9</span>     &lt;!-- 如果需要分页器 --&gt;</span><br><span class="line"><span class="number">10</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-pagination"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="number">11</span>     </span><br><span class="line"><span class="number">12</span>     &lt;!-- 如果需要导航按钮 --&gt;</span><br><span class="line"><span class="number">13</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-button-prev"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="number">14</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-button-next"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="number">15</span>     </span><br><span class="line"><span class="number">16</span>     &lt;!-- 如果需要滚动条 --&gt;</span><br><span class="line"><span class="number">17</span>     &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"swiper-scrollbar"</span>&gt;<span class="xml"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="number">18</span> &lt;<span class="regexp">/div&gt;</span></span><br><span class="line"><span class="regexp">19   &lt;/</span>div&gt;</span><br><span class="line"><span class="number">20</span> &lt;<span class="regexp">/template&gt;</span></span><br><span class="line"><span class="regexp">21 </span></span><br><span class="line"><span class="regexp">22 &lt;script&gt;</span></span><br><span class="line"><span class="regexp">23 </span></span><br><span class="line"><span class="regexp">24 export default &#123;</span></span><br><span class="line"><span class="regexp">25   name: 'HelloWorld',</span></span><br><span class="line"><span class="regexp">26   data () &#123;</span></span><br><span class="line"><span class="regexp">27     return &#123;</span></span><br><span class="line"><span class="regexp">28       msg: 'Welcome to Your Vue.js App'</span></span><br><span class="line"><span class="regexp">29     &#125;</span></span><br><span class="line"><span class="regexp">30   &#125;,</span></span><br><span class="line"><span class="regexp">31   mounted()&#123;</span></span><br><span class="line"><span class="regexp">32      var mySwiper = new Swiper ('.swiper-container', &#123;</span></span><br><span class="line"><span class="regexp">33     loop: true,</span></span><br><span class="line"><span class="regexp">34     /</span><span class="regexp">/ 如果需要分页器</span></span><br><span class="line"><span class="regexp">35     pagination: '.swiper-pagination',</span></span><br><span class="line"><span class="regexp">36     /</span><span class="regexp">/ 如果需要前进后退按钮</span></span><br><span class="line"><span class="regexp">37     nextButton: '.swiper-button-next',</span></span><br><span class="line"><span class="regexp">38     prevButton: '.swiper-button-prev',</span></span><br><span class="line"><span class="regexp">39     /</span><span class="regexp">/ 如果需要滚动条</span></span><br><span class="line"><span class="regexp">40     scrollbar: '.swiper-scrollbar',</span></span><br><span class="line"><span class="regexp">41   &#125;)        </span></span><br><span class="line"><span class="regexp">42   &#125;</span></span><br><span class="line"><span class="regexp">43 &#125;</span></span><br><span class="line"><span class="regexp">44 &lt;/</span>script&gt;</span><br><span class="line"><span class="number">45</span> </span><br><span class="line"><span class="number">46</span> &lt;!-- Add <span class="string">"scoped"</span> attribute to limit CSS to <span class="keyword">this</span> component only --&gt;</span><br><span class="line"><span class="number">47</span> &lt;style scoped&gt;</span><br><span class="line"><span class="number">48</span> </span><br><span class="line"><span class="number">49</span>     body &#123;</span><br><span class="line"><span class="number">50</span>         margin: <span class="number">0</span>;</span><br><span class="line"><span class="number">51</span>         padding: <span class="number">0</span>;</span><br><span class="line"><span class="number">52</span>     &#125;</span><br><span class="line"><span class="number">53</span>     .swiper-container &#123;</span><br><span class="line"><span class="number">54</span>         width: <span class="number">500</span>px;</span><br><span class="line"><span class="number">55</span>         height: <span class="number">300</span>px;</span><br><span class="line"><span class="number">56</span>         margin: <span class="number">20</span>px auto;</span><br><span class="line"><span class="number">57</span>     &#125;</span><br><span class="line"><span class="number">58</span>    </span><br><span class="line"><span class="number">59</span> </span><br><span class="line"><span class="number">60</span>     &lt;<span class="regexp">/style&gt;</span></span><br></pre></td></tr></table></figure>
<p>main.js文件代码：<br><img src="https://user-gold-cdn.xitu.io/2020/1/4/16f6c631106ff801?w=830&h=634&f=png&s=61090" alt=""></p>
<p> 常见报错解决：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Uncaught TypeError: Cannot assign to read only property &#39;exports&#39; of object &#39;#&lt;Object&gt;&#39;</span><br></pre></td></tr></table></figure>
<p>.babelrc文件里的插件项”plugins”: [“transform-runtime”],中的transform-runtime删掉即可；</p>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/javascript/" rel="tag"># javascript</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2017/03/20/HTML5%E8%AF%A6%E8%A7%A3-3/" rel="prev" title="HTML5详解-3">
      <i class="fa fa-chevron-left"></i> HTML5详解-3
    </a></div>
      <div class="post-nav-item">
    <a href="/2017/05/11/01-JS%E7%AE%80%E4%BB%8B/" rel="next" title="javascript简介">
      javascript简介 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let activeClass = CONFIG.comments.activeClass;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#vue引入swiper-vue使用swiper-vue脚手架使用swiper-引入js文件-引入css文件"><span class="nav-number">1.</span> <span class="nav-text">vue引入swiper  vue使用swiper  vue脚手架使用swiper &#x2F;引入js文件&#x2F;引入css文件</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#方法一：（-请先使用这种方法；更新于2018-05-14）"><span class="nav-number">1.1.</span> <span class="nav-text">方法一：（ 请先使用这种方法；更新于2018-05-14）</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#html："><span class="nav-number">2.</span> <span class="nav-text">html：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#js："><span class="nav-number">3.</span> <span class="nav-text">js：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#css："><span class="nav-number">4.</span> <span class="nav-text">css：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#方法二：（以下是2017年4月写的-废弃）"><span class="nav-number">5.</span> <span class="nav-text">方法二：（以下是2017年4月写的,废弃）</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#3-1html部分："><span class="nav-number">5.0.1.</span> <span class="nav-text">3.1html部分：</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-2-js部分："><span class="nav-number">5.1.</span> <span class="nav-text">3.2 js部分：</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#3-3css部分："><span class="nav-number">5.1.1.</span> <span class="nav-text">3.3css部分：</span></a></li></ol></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="王志超"
      src="/images/logo.png">
  <p class="site-author-name" itemprop="name">王志超</p>
  <div class="site-description" itemprop="description">记录前端的点点滴滴</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives">
          <span class="site-state-item-count">19</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL3d6YzU3MDczODIwNQ==" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;wzc570738205"><i class="fa fa-fw fa-github"></i>GitHub</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly93d3cuY25ibG9ncy5jb20vd2FuZ3poaWNoYW8v" title="博客园 → https:&#x2F;&#x2F;www.cnblogs.com&#x2F;wangzhichao&#x2F;"><i class="fa fa-fw fa-globe"></i>博客园</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cDovL21haWwucXEuY29tL2NnaS1iaW4vcW1fc2hhcmU/dD1xbV9tYWlsbWUmZW1haWw9eHJHOHBmLXo5dkgzLTRhM3RfaWxxYXM=" title="E-Mail → http:&#x2F;&#x2F;mail.qq.com&#x2F;cgi-bin&#x2F;qm_share?t&#x3D;qm_mailme&amp;email&#x3D;xrG8pf-z9vH3-4a3t_ilqas"><i class="fa fa-fw fa-envelope"></i>E-Mail</span>
      </span>
      <span class="links-of-author-item">
        <a href="//shang.qq.com/wpa/qunwpa?idkey=f528775f242a7c39fe8512383febb8990e621bf97354c2fb82f6832097b7c501" target="_blank" rel="noopener" title="QQ群 → &#x2F;&#x2F;shang.qq.com&#x2F;wpa&#x2F;qunwpa?idkey&#x3D;f528775f242a7c39fe8512383febb8990e621bf97354c2fb82f6832097b7c501"><i class="fa fa-fw fa-qq"></i>QQ群</a>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cDovL3dhbmd6Yy53YW5nL3dlYnNvY2tldC8=" title="websocket → http:&#x2F;&#x2F;wangzc.wang&#x2F;websocket&#x2F;"><i class="fa fa-fw fa-comments"></i>websocket</span>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 2015 – 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">王志超</span>
</div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>

<script src="/js/bookmark.js"></script>




  




  
<script src="/js/local-search.js"></script>









<script>
if (document.querySelectorAll('div.pdf').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/pdfobject@2/pdfobject.min.js', () => {
    document.querySelectorAll('div.pdf').forEach(element => {
      PDFObject.embed(element.getAttribute('target'), element, {
        pdfOpenParams: {
          navpanes: 0,
          toolbar: 0,
          statusbar: 0,
          pagemode: 'thumbs',
          view: 'FitH'
        },
        PDFJS_URL: '/lib/pdf/web/viewer.html',
        height: element.getAttribute('height') || '700px'
      });
    });
  }, window.PDFObject);
}
</script>




  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el: '#valine-comments',
      verify: false,
      notify: false,
      appId: '9fgm6JVbw8PrOlvp7LfsKjsh-gzGzoHsz',
      appKey: 'LReLvzSwPnBOAz5LiIgJsiDO',
      placeholder: "说点什么吧",
      avatar: 'mm',
      meta: guest,
      pageSize: '10' || 10,
      visitor: false,
      lang: 'zh-cn' || 'zh-cn',
      path: location.pathname,
      recordIP: false,
      serverURLs: ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
